package com.yunquan.ohana.base.binding.viewadapter.recyclerview

import androidx.recyclerview.widget.RecyclerView

/**
 * $
 * @author yjp
 * @date 2020/3/26 15:56
 */
object LineManagers {

    fun both(): LineManagerFactory {
        return object : LineManagerFactory {
            override fun create(recyclerView: RecyclerView): RecyclerView.ItemDecoration {
                return DividerLine(recyclerView.context, LineDrawMode.BOTH)
            }
        }
    }

    fun both(size:Int): LineManagerFactory {
        return object : LineManagerFactory {
            override fun create(recyclerView: RecyclerView): RecyclerView.ItemDecoration {
                return DividerLine(recyclerView.context,size, LineDrawMode.BOTH)
            }
        }
    }

    fun horizontal():LineManagerFactory{
        return object : LineManagerFactory{
            override fun create(recyclerView: RecyclerView): RecyclerView.ItemDecoration {
                return DividerLine(recyclerView.context,LineDrawMode.HORIZONTAL)
            }
        }
    }

    fun horizontal(size:Int):LineManagerFactory{
        return object : LineManagerFactory{
            override fun create(recyclerView: RecyclerView): RecyclerView.ItemDecoration {
                return DividerLine(recyclerView.context,size,LineDrawMode.HORIZONTAL)
            }
        }
    }

    fun vertical():LineManagerFactory{
        return object : LineManagerFactory{
            override fun create(recyclerView: RecyclerView): RecyclerView.ItemDecoration {
                return DividerLine(recyclerView.context,LineDrawMode.VERTICAL)
            }
        }
    }

    fun vertical(size:Int):LineManagerFactory{
        return object : LineManagerFactory{
            override fun create(recyclerView: RecyclerView): RecyclerView.ItemDecoration {
                return DividerLine(recyclerView.context,size,LineDrawMode.VERTICAL)
            }
        }
    }
}


interface LineManagerFactory {
    fun create(recyclerView: RecyclerView): RecyclerView.ItemDecoration
}
